package host.skiree.nettydemo.server.service;

import host.skiree.nettydemo.message.*;
import host.skiree.nettydemo.server.service.impl.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author gcl
 * @date 2022/9/19 8:44
 */
public class MessageHandlerFactory {

    /**
     * 存储策略handler容器
     */
    public static final Map<Integer, MessageHandler> MESSAGE_HANDLER = new HashMap<>();

    static {
        MESSAGE_HANDLER.put(Message.PingMessage, new Ping());
        MESSAGE_HANDLER.put(Message.LoginRequestMessage, new Login());
        MESSAGE_HANDLER.put(Message.ChatRequestMessage, new Chat());
        MESSAGE_HANDLER.put(Message.UserListRequestMessage, new UserList());
        MESSAGE_HANDLER.put(Message.GroupCreateRequestMessage, new GroupCreate());
        MESSAGE_HANDLER.put(Message.GroupListRequestMessage, new GroupList());
        MESSAGE_HANDLER.put(Message.GroupChatRequestMessage, new GroupChat());
        MESSAGE_HANDLER.put(Message.GroupMembersRequestMessage, new GroupMembers());
        MESSAGE_HANDLER.put(Message.GroupJoinRequestMessage, new GroupJoin());
        MESSAGE_HANDLER.put(Message.GroupQuitRequestMessage, new GroupQuit());
    }

}
